- wiki_page_title @page
- add_page_specific_style 'page_bundles/wiki'

.wiki-page-header.top-area.has-sidebar-toggle.flex-column.flex-lg-row
  = wiki_sidebar_toggle_button

  .nav-text.flex-fill
    %span.wiki-last-edit-by
      - if @page.last_version
        = wiki_page_version_author_header(@page.last_version)
        = time_ago_with_tooltip(@page.last_version.authored_date)

  .nav-controls.pb-md-3.pb-lg-0
    = render 'shared/wikis/main_links'
    - if Feature.enabled?(:print_wiki, current_user)
      #js-export-actions{ data: { options: { target: '.js-wiki-page-content', title: @page.human_title, stylesheet: [stylesheet_path('application')] }.to_json } }

- if @page.historical?
  = render Pajamas::AlertComponent.new(variant: :warning,
    dismissible: false) do |c|
    - c.with_body do
      = s_("WikiHistoricalPage|This is an old version of this page.")
    - c.with_actions do
      .gl-display-flex.gl-gap-3
        = render Pajamas::ButtonComponent.new(category: :primary, variant: :confirm, href: wiki_page_path(@wiki, @page)) do
          = s_('WikiHistoricalPage|Go to most recent version')
        = render Pajamas::ButtonComponent.new(href: wiki_page_path(@wiki, @page, action: :history)) do
          = s_('WikiHistoricalPage|Browse history')

.gl-mt-5.gl-mb-3
  .gl-display-flex.gl-justify-content-space-between
    %h2.gl-mt-0.gl-mb-5{ data: { qa_selector: 'wiki_page_title', testid: 'wiki_page_title' } }= @page.human_title
    %div
      - if can?(current_user, :create_wiki, @wiki.container) && @page.latest? && @valid_encoding
        = render Pajamas::ButtonComponent.new(href: wiki_page_path(@wiki, @page, action: :edit), icon: 'pencil', button_options: { class: 'js-wiki-edit', title: "Edit", data: { qa_selector: 'edit_page_button', testid: 'wiki_edit_button' }})

  .js-async-wiki-page-content.md.gl-pt-2{ data: { qa_selector: 'wiki_page_content', testid: 'wiki-page-content', tracking_context: wiki_page_tracking_context(@page).to_json, get_wiki_content_url: wiki_page_render_api_endpoint(@page) } }

= render 'shared/wikis/sidebar'
